package tags;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.SimpleTagSupport;

public class SegurancaTag extends SimpleTagSupport {

	@Override
	public void doTag() throws JspException, IOException {
		PageContext pageContext = (PageContext) getJspContext();
		try {
			Object obj = pageContext.findAttribute("usuario");
			if (obj == null) {
				pageContext.forward("login.jsp");
			}
		} catch (ServletException e) {
			e.printStackTrace();
		}
	}
	
}
